package router

import (
	"jgt-oper/src/context"
	"jgt-oper/src/svc"

	"github.com/facebookgo/inject"
	"github.com/teambition/gear"
)

// SvcLoginMap 注册登录管理路由映射
func SvcLoginMap(g *inject.Graph, router *gear.Router) {
	loginSvc := new(svc.Login)
	err := g.Provide(&inject.Object{Value: loginSvc})
	if err != nil {
		panic(err)
	}

	router.Get("/current/user", context.WrapContext(loginSvc.GetUserInfo))
	router.Get("/current/menus", context.WrapContext(loginSvc.QueryUserMenus))
	router.Post("/current/updatepwd", context.WrapContext(loginSvc.UpdatePassword))
	router.Post("/login", context.WrapContext(loginSvc.Verify))
	router.Post("/logout", context.WrapContext(loginSvc.Logout))
}
